<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2021-2022 yangrunkang
  ~
  ~ Author: yangrunkang
  ~ Email: yangrunkang53@gmail.com
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="index">
<!--css-->
<link th:fragment="css" type="text/css" rel="stylesheet" th:href="${ossStatic} + @{/css/todo/index.css}"/>
<!--脚本-->
<script async="async" th:fragment="js" type="text/javascript" th:src="${ossStatic} + @{/js/todo/index.js}"></script>
<div th:fragment="content" >
    <div class="container" id="todo-index">
        <div class="row g-2">
            <div class="col-lg-9 mb-2">
                <!--添加待办-->
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2">
                    <form>
                        <div class="form-floating mb-3">
                            <input type="text" class="form-control" id="todo">
                            <label for="todo">待办</label>
                        </div>
                        <!--<div class="form-floating mb-3">
                            <input type="text" class="form-control" id="todoDetail">
                            <label for="todoDetail">明细 <small class="text-black-50">选填</small></label>
                        </div>-->
                        <button type="submit" class="btn rounded-3 bg-gradient btn-primary">添加</button>
                    </form>
                </div>
                <!--待办列表-->
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 mt-2">
                    <div class="lead border-bottom mb-2">我的待办</div>
                    <div th:if="${#lists.isEmpty(todoIndexDto.listTodoDto.todoList)}" th:include="fragments/index::empty_content"></div>
                    <ul class="list-group list-group-flush">
                        <li th:class="${todo.status.name() == 'UN_DO'} ? 'list-group-item' : 'list-group-item text-decoration-line-through text-black-50'" th:inline="text"
                               th:if="!${#lists.isEmpty(todoIndexDto.listTodoDto.todoList)}"
                               th:each="todo,ite : ${todoIndexDto.listTodoDto.todoList}"
                               th:id="${todo.todoId}"
                        >
                            <input class="form-check-input me-1" type="checkbox" th:if="${todo.status.name() == 'UN_DO'}"  th:onclick="markTodo([[${todo.todoId}]])">
                            <input class="form-check-input me-1" type="checkbox" th:if="${todo.status.name() == 'DONE'}" checked th:onclick="markTodo([[${todo.todoId}]])">
                            <span>
                                <span class="fw-bold">
                                    [[${todo.title}]]
                                    <button th:id="${todo.todoId} + 'delete_forever'"
                                    th:class="${todo.status.name() == 'UN_DO'} ?'btn btn-danger btn-sm text-decoration-none float-end invisible': 'btn btn-danger btn-sm text-decoration-none float-end'"
                                    th:onclick="deleteTodo([[${todo.todoId}]])">永久删除</button>
                                </span>
                                <span class="badge bg-gradient rounded-3 bg-secondary ms-1" th:inline="text">[[${todo.createDate}]]</span>
                            </span>

                        </li>
                    </ul>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2">
                    <div class="lead border-bottom mb-2">待办</div>
                    <div><span class="badge bg-gradient bg-success">写下</span>待办,然后您需要做的就是<span class="badge bg-gradient bg-success">完成它</span>!</div>
                </div>
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 mt-2">
                    <div class="text-sm-left border-0"><img class="lazyload cv-icon-small" th:data-src="${ossStatic} + @{/icons/v.svg}" /> 当您开始行动的时候,您已经比90%的人优秀了</div>
                </div>
                <div th:replace="fragments/index::user_manage_fragment(true)"></div>
                <div th:include="fragments/index::global_search"></div>
                <div class="mt-2" th:include="fragments/index::google_right_ad"></div>
            </div>
        </div>
    </div>
</div>
</html>
